<?php

namespace posts\model;

class Post {

	/**
	 * @var string $username
	 */
	public $username;
	/**
	 * @var string $Title
	 */
	public $Title;
	/**
	 * @var string $Text
	 */
	public $Text;
	/**
	 * @var string $imagePath
	 */
	public $imagePath;
	/**
	 * @var int $ID
	 */
	public $ID;
	const postId = "postId";

	//set membervariables
	public function __construct($username, $postID, $postTitle, $postText, $imagePath) {
		$this->username = $username;
		$this->Title = $postTitle;
		$this->Text = $postText;
		$this->ID = $postID;
		$this->imagePath = $imagePath;
		$this->savePostId($this->ID);
	}	

	//save the current postId to session
	public function savePostId($id) {
		$_SESSION[self::postId] = $id;
	}
}